<?php echo $header;?>
<div id="content">
  <div class="box">
   <div class="heading">
      <h1><img src="view/image/information.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a href="<?php echo $cancel; ?>" class="button"><?php echo $button_cancel; ?></a></div>
    </div>
     <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
		<table class="form">
	      <tr>
		    <td><span class="required">*</span> <?php echo "名称"; ?></td>
            	<td ><input  value="<?php echo $name;?>"   id="name" name="name" >
			</td>
			</tr>
			
			<tr>
		    <td><span class="required">*</span> <?php echo "招领地址"; ?></td>
            	<td ><select name="community_id">
            		<option value="-1">请选择...</option>
            		<?php foreach ($communitys as $community) { ?>
            			<option value="<?php echo $community['community_id']?>" <?php if($community_id==$community['community_id']){?> selected="selected" <?php }?>><?php echo $community['title'];?></option>
            		<?php  }?>
            	</select>
			</td>
			</tr>
			
			
			<tr>
				<td>图片</td>
				<td class="left" id="picurl">
					  <div class="image"><img src="<?php echo $abPic; ?>" alt="" id="thumb" /><br />
	                  <input type="hidden" name="pic_url" value="<?php echo $pic_url; ?>" id="image" />
	                  <a onclick="image_upload('image', 'thumb');"><?php echo $text_browse; ?></a>
	                  &nbsp;&nbsp;|&nbsp;&nbsp;
	                  <a onclick="$('#thumb').attr('src', '<?php echo $no_image; ?>'); $('#image').attr('value', '');"><?php echo $text_clear; ?></a>
	                  </div>
				 </td>
			</tr>
			
				<tr>
			<td><span class="required">*</span> <?php echo "概要"; ?></td>
			 <td>
					<textarea cols="50" rows="5" name="summary" ><?php echo $summary; ?></textarea>
				 </td>
			</tr>
			
			<tr>
			<td><span class="required">*</span> <?php echo "描述"; ?></td>
			 <td>
					<textarea cols="50" rows="20" name="description" class="ckeditor"><?php echo $description; ?></textarea>
				 </td>
			</tr>
			
			<tr>
		    <td><span class="required">*</span> <?php echo "登记时间"; ?></td>
            	<td ><input  value="<?php echo $date_added;?>"   id="date_added" name="date_added" class="date">
			</td>
			</tr>
			
			 <tr>
              <td>领取状态</td>
              <td><select name="status">
                  <?php if ($status) { ?>
                  <option value="1" selected="selected"><?php echo "已领取"; ?></option>
                  <option value="0"><?php echo "未领取"; ?></option>
                  <?php } else { ?>
                  <option value="1"><?php echo "已领取"; ?></option>
                  <option value="0" selected="selected"><?php echo "未领取"; ?></option>
                  <?php } ?>
                </select></td>
            </tr>
			
        </table>
      </form>
      </div>
  </div>
  </div>
  <script type="text/javascript" src="view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript"><!--
$('.date').datepicker({dateFormat: 'yy-mm-dd'});
$('.datetime').datetimepicker({
	dateFormat: 'yy-mm-dd',
	timeFormat: 'h:m'
});
$('.time').timepicker({timeFormat: 'h:m'});
//--></script> 

<script type="text/javascript"><!--
CKEDITOR.replace('description', {
	filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	toolbar :
        [
['Source'],
['Maximize'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['SpecialChar'],
'/',
['Undo','Redo'],
['Font','FontSize'],
['TextColor','BGColor'],
['Link','Unlink','Anchor'],
['Image','Table','HorizontalRule']
        ]
});
//--></script> 


<script type="text/javascript"><!--
function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).attr('value')),
					dataType: 'text',
					success: function(text) {
						$('#' + thumb).replaceWith('<img src="' + text + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 

<?php echo $footer;?>
